package etc.spec.ytt.week8.home.D3t;

public class Student extends Person {
    public String no;
    public double scoreOfEn;
    public double scoreOfMath;
    public double scoreOfCh;

    public Student(String name, char sex, int age, String no, double scoreOfEn, double scoreOfMath, double scoreOfCh) {
        super(name, age, sex);
        this.no = no;
        this.scoreOfCh = scoreOfCh;
        this.scoreOfEn = scoreOfEn;
        this.scoreOfMath = scoreOfMath;
    }

    public double aver() {
        double sum;
        sum = scoreOfCh + scoreOfMath + scoreOfEn;
        return (sum / 3);
    }

    public double max() {
        double result ;
        if (scoreOfEn > scoreOfMath) {
            if (scoreOfEn > scoreOfCh) {
                result = scoreOfEn;
            } else {
                result = scoreOfMath;
            }
            if (scoreOfMath > scoreOfCh) {
                return scoreOfMath;
            } else {
                return scoreOfCh;
            }
        }
        return 0;
    }

    public double min() {
        double result;
        if (scoreOfEn < scoreOfMath) {
            if (scoreOfEn < scoreOfCh) {
                result = scoreOfEn;
            } else {
                result = scoreOfMath;
            }
            if (scoreOfMath < scoreOfCh) {
                return scoreOfMath;
            } else {
                return scoreOfCh;
            }
            return 0;
        }
    }
    public String toString(){
        return "学号："+this.no+"姓名："+this.name+"性别:"+this.sex+"" +"年龄："+this.age+"平均分："+this.aver()
                +"最高分："+this.max()+"最低分："+this.min();
    }
    public static void main(String[]args){
        Student s=new Student("袁甜甜", "女","20","1713630027","78","90","89");
        System.out.println(s);
    }
    }


